#ifndef MESSAGE_H
#define MESSAGE_H

#include "types.h"
#include "string.h"
#include "null.h"
#include "error_codes.h"
#include "dynamic_memory.h"
#include "system_id.h"
#include "message_definition.h"

/* function declarations */

/* Returns 1 if the messages have the same priority */
int32_t compare_priority(void* arg1, void* arg2);

/* Returns 1 if the messaes have the same sender */
int32_t compare_from(void* arg1, void* arg2);

/* Frees a message */
int32_t free_message(message* m, int32_t owner);

/* setters */

void message_set_from(message* target, int32_t from);

void message_set_to(message* target, int32_t to);

void message_set_data_flag(message* target, int8_t data_flag);

void message_set_priority(message* target, int32_t priority);

void message_set_int_value(message* target, int32_t value);

/* Returns either SUCCESS or OUT_OF_MEMORY */
int32_t message_set_str_value(message* target, char* value, int32_t owner);

void message_set_pinfo_values(message* target, uint32_t priority, int32_t program_id, int32_t parent, int32_t status);

#endif 
